﻿using UnityEngine;
using System.Collections;

public class enemy : MonoBehaviour 
{
	public float velocity;

	// declara a posicão do enemy
	Vector3 initialPosition;


	// Use this for initialization
	void Start () 
	{

		initialPosition = transform.position;
	}
	
	// Update is called once per frame
	void Update () 
	{
		// declara em que posicão o enemy deve se mover X, Y, ou Z. No caso X.
		transform.Translate(velocity * Time.deltaTime, 0, 0);

		//se a posicão do enemy for maior que 6 voltar para posicão inicial
		if(transform.position.x > 6)
		{
			transform.position = initialPosition;

			//
			//GetComponentInChildren<shoot_enemy1>().canShoot = true;
						
			//GetComponentInChildren<shoot_enemy2>().canShoot = true;

			//transform.position = Vector2(4, 0, 0);

		}

	}
}
